<template>
  <div class="custom-body" :style="borderStyle">
    <!--  模版头  -->
    <default-column-header v-if="showHeader" :temp="temp" />
    <el-empty
      v-if="dataList === null || dataList.length === 0"
      :image-size="100"
    />
    <div v-else class="custom-right">
      <div
        v-for="(item, index) in dataList"
        :key="'server-' + index"
        :style="liStyle"
        class="custom-right-li"
        @click="openEntity(item)"
      >
        <div class="right-content" :style="lineStyle">
          <div class="custom-li-image">
            <el-image
              class="custom-image"
              :src="baseURL+item[column[0].image]"
            />
          </div>
          <div class="custom-li-line header">{{ item[column[0].title] }}</div>
          <div class="custom-li-line" style="color: #a8abb2">
            {{ item[column[0].left1]=== undefined ? '': item[column[0].left1] }}
            {{ item[column[0].left2] === undefined ?'' : '&nbsp;' + item[column[0].left2] }}
            {{ item[column[0].left3] === undefined ?'': '&nbsp;' + item[column[0].left3] }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { template } from '@/mixins/template'
import DefaultColumnHeader from '@/portal4.1/pc/component/column/DefaultColumnHeader.vue'
import { layout } from '@/mixins/layout'
export default {
  name: 'PcImageListTempV1',
  components: { DefaultColumnHeader },
  // 快速导航
  mixins: [template, layout],
  computed: {
    lineStyle() {
      return {
        '--font-color': this.layoutTheme.menuColor,
        '--font-active-color': this.layoutTheme.menuActiveColor
      }
    },
    liStyle() {
      const width = (100 / this.setting.row).toFixed(2)
      const height = (
        100 / Math.ceil(this.setting.size / this.setting.row)
      ).toFixed(2)
      if (this.themes) {
        return {
          width: width + '%',
          height: height + '%',
          borderRight: '1px solid ' + this.themes.bkys,
          borderBottom: '1px solid ' + this.themes.bkys
        }
      } else {
        return {
          width: width + '%',
          height: height + '%'
        }
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.custom-body {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-flow: column nowrap;
  background-color: #ffffff;
  border-radius: 4px;
  box-sizing: border-box;
  overflow: hidden;
}
.custom-right {
  flex: 1 1;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-flow: row wrap;
}
.custom-right-li {
  width: 33.3333%;
  padding: 10px;
  box-sizing: border-box;
  cursor: pointer;
  height: 50%;
  position: relative;
}
.custom-li-image {
  width: 50px;
  height: 50px;
  padding: 4px;
  text-align: center;
}
.right-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: column nowrap;
  padding: 10px;
  box-sizing: border-box;
  justify-content: center;
  align-items: center;
  background-color: #f5f5f5;
  position: relative;
}
.right-content:hover:before {
  height: 3px;
  content: '';
  top: 0;
  left: 0;
  right: 0;
  position: absolute;
  background-color: #3f51b5;
}
.custom-li-line {
  width: 100%;
  padding: 5px;
  box-sizing: border-box;
  text-align: center;
  font-size: 0.9rem;
}
.custom-li-line.header {
  font-weight: 600;
}
</style>
